<template>
    <input type="text" v-model="val">
    <button @click="handleAdd">点击</button>
</template>
<script setup>
import { defineEmits,ref } from 'vue';
let val=ref("")
let emit=defineEmits(['add'])
let handleAdd=()=>{
    emit('add',val.value)
}
</script>